<?php
/*
+-------------------------------------------
|   [Internet XML News Aggregator]
|   ===================================
|   Web: http://www.ixna.net
|	update
|	$Id: update.php
+-------------------------------------------
|   Autohr	:	Zxsv(Gmail.MSN.QQ:zxswww@gmail.com)
+-------------------------------------------
*/
require_once('global.php');
$query=$db->query("SELECT * FROM {$tablepre}xna_site WHERE state='1'");
while ($row=$db->row($query)){
    $done = "no";
    $utime = $row["uptime"];
    
	    if (DateDiff("n",$utime,time())< $options[rsstime]) break;
	    if ($row["isupdate"]==1) exit;
			$row["isupdate"] = 0;
    	if ($utime == "943891200") $done = "yes";
    		$xtime = time() - $options[rsstime] * 60;
    	if ($utime < $xtime) $done = "yes";
	    if ($done == "yes") {
	        ob_start();
	        doFetch($row[siteid]);
	        $msg .= ob_get_contents();
	        ob_get_clean();
	        $msg .= "" . $row[siteid] . "" . _LANG_0001 . "";
	    }
	$row["isupdate"] = 1;
}
$msg = $msg == "" ? "" . _LANG_0002 . "":$msg;
echo "msg=\"" . $msg . "\";";
$time = date('Y-m-d h:m:s') . "\n";
$date = date("Ymd");
if ($msg != "" . _LANG_0002 . ""){
	@header("Content-Type: text/html; charset=utf-8");
    $content = "$time$msg\n";
    $fp = fopen(_ROOT . "/cache/log/$date.log", a);
    fputs($fp, $content);
    fclose($fp);
}
?>